//
//  ViewController.m
//  jisuanqi
//
//  Created by mac on 16-3-1.
//  Copyright (c) 2016年 mac. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
	// Do any additional setup after loading the view, typically from a nib.
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

-(IBAction)method
{
    NSString * text1 = self.textField1.text;
    NSString * text2 = self.textField2.text;
    int num1 = [text1 intValue];
    int num2 = [text2 intValue];
    int result = 0;
    //NSString * yunsuanfu = self.pl.text;
    //char ysf = [yuansuanfu characterAtIndex:0];
    /*switch (ysf) {
        case '+':
            result = num1+num2; 
            break;
        case '-':
            result = num1-num2;
            break;
        case '*':
            result = num1*num2;
            break;
        case '/':
            result = num1/num2;
            break;
        default:
            break;
    }*/
    
    result = num1-num2;
    NSString * output = [NSString stringWithFormat:@"%d",result];
    self.res.text = output;
    //NSLog(@"计算按钮被点击了");
    
    NSLog(@"%d",result);
    [self.view endEditing:YES];
}

@end
